package com.twu.biblioteca.menu;

import com.twu.biblioteca.BibliotecaApp;
import com.twu.biblioteca.model.Book;
import com.twu.biblioteca.model.User;

import java.io.PrintStream;


/**
 * @author Aaron Edwards
 * @since 24/09/13
 *        menu item that will display all the books in the current collection using their display string
 */
public class ViewBooksMenuItem implements IMenuItem {


    @Override
    public String getMenuTitleForUser(User currentUser) {
        return "View Library Book Collection";
    }

    @Override
    public void doAction(BibliotecaApp bibliotecaApp) {
        PrintStream output = bibliotecaApp.getOutputStream();
        output.println("Book Collection");
        for (Book book : bibliotecaApp.getBookCollection().getItemList()) {
            output.println(book.getDisplayString());
        }
    }
}
